package com.gamemost.libepub;

import java.util.ArrayList;

public class NSDictionary {
	ArrayList<Item> itemList = new ArrayList<Item>();	
	public void addItem(Item aItem) {
		itemList.add(aItem);
	}
	public Item getHref(String id) {
		  Item aItem = null;
		  for (int i = 0; i < itemList.size(); i++) {
		   if (itemList.get(i).getKey().equals(id)) {
		    aItem = itemList.get(i);
		    break;
		   }
		  }
		  return aItem;
		 }
	
	public String getRelativePath() {
		  String path = "";
		  Item aItem;
		  for (int i = 0; i < itemList.size(); i++) {
		   aItem = itemList.get(i);
		   if (aItem.getObject().contains("xhtml")
		     && aItem.getObject().contains("/")) {
		    String[] tmp = aItem.getObject().split("/");
		    for (int j = 0; j < tmp.length - 1; j++) {
				  System.out.println("get path k");

		     path += tmp[j];
		     path += "/";
		    }
		    break;
		   }
		  }
		  return path;
		 }
}
